\documentclass[tikz,border=2mm]{standalone}
\usepackage{array,amsmath,mathptmx,xcolor,bbding,pifont,colortbl}
\usepackage[UTF8]{ctex}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% 只需要这个就可以
\usepackage[thicklines]{cancel}
% 可以设置线条颜色，默认是黑色
\usepackage{xcolor}
\usepackage{tikz-cd}
\usepackage{tikz,graphicx,subfig,caption} % Required for drawing custom shapes
\usetikzlibrary{fit,matrix,chains,arrows,shapes,positioning,arrows.meta,chains,shadows,shapes.callouts,decorations.text,shapes.symbols,shapes.misc, positioning,decorations.pathreplacing,calc,backgrounds,}

% 额外添加
\usepackage{indentfirst}
\usepackage{diagbox}
\usepackage{amssymb}
\usepackage{pifont}

\begin{document} 
	\begin{tikzpicture}[>=latex,every node/.style={anchor=south west,,inner sep=0,fill=white}]
		\node(m_start)[draw, rounded rectangle, anchor=north,align=left,fill=white,inner sep=0.3em] at (0,0){开始}; 
		\node(m_init)[draw, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]m_start.south){初始化}; 
		\node(m_next)[anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]m_init.south){NEXT(w)}; 
		\node(m_E)[draw, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]m_next.south){\qquad E\quad}; 
		\draw[-] ([xshift=-1.2em,yshift=0em]m_E.north) -- ([xshift=-1.2em,yshift=0em]m_E.south);
		\node(m_select)[draw, diamond,aspect=2, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]m_E.south){ \# }; 
		\node(m_output)[draw, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]m_select.south){ 结果输出 }; 
		\node(m_erro)[anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=-5em,yshift=-1.2em]m_select.south){ err0 }; 
		\node(m_end)[draw, rounded rectangle, anchor=north,align=left,fill=white,inner sep=0.3em] at 
		([xshift=0em,yshift=-1.2em]m_output.south){结束}; 
		
		\draw[->] (m_start.south) -- (m_init.north);
		\draw[->] (m_init.south) -- (m_next.north);
		\draw[->] (m_next.south) -- (m_E.north);
		\draw[->] (m_E.south) -- (m_select.north);
		\draw[->] (m_select.south) -- (m_output.north);
		\draw[->] (m_select.west) -| (m_erro.north);
		\draw[->] (m_output.south) -- (m_end.north);
		\node(m_R0)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=1em,yshift=-0.6em]m_E.south){\textcolor{blue}{R0}}; 
		\node(m_y)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=1em,yshift=-0.3em]m_select.south){y};
		\node(m_n)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=1em,yshift=3.3em]m_erro.north){n};
		
		\node(note1)[draw, rectangle callout,callout relative pointer={(0.8,0.7)},rounded corners,align=center,inner sep=0.3em] at ([xshift=-6em,yshift=-4.7em]m_start.south){ 主\\程\\序\\Z };
		
		\begin{pgfonlayer}{background}
			\node [draw, draw=black, fill=white,fit=(m_start)(m_init)(m_next)(m_E)(m_select)(m_output)(m_end)(m_erro),inner sep=0.5em] {};
		\end{pgfonlayer}
		
		\node(s_enter)[draw, rounded rectangle, anchor=west,align=left,fill=white,inner sep=0.3em] at ([xshift=5.5em,yshift=0em]m_start.east){入口}; 
		\node(s_T)[draw, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]s_enter.south){\qquad T\quad}; 
		\draw[-] ([xshift=-1.2em,yshift=0em]s_T.north) -- ([xshift=-1.2em,yshift=0em]s_T.south);
		\node(s_select1)[draw, diamond,aspect=2, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.8em]s_T.south){ + }; 
		\node(s_select2)[draw, diamond,aspect=2, anchor=west,align=left,fill=white,inner sep=0.3em] at ([xshift=2em,yshift=0em]s_select1.east){ $-$ }; 
		\node(s_next1)[anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]s_select1.south){NEXT(w)}; 
		\node(s_next2)[anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]s_select2.south){NEXT(w)};
		\node(s_T1)[draw, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]s_next1.south){\qquad T\quad};
		\draw[-] ([xshift=-1.2em,yshift=0em]s_T1.north) -- ([xshift=-1.2em,yshift=0em]s_T1.south);
		\node(s_T2)[draw, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.2em]s_next2.south){\qquad T\quad};
		\draw[-] ([xshift=-1.2em,yshift=0em]s_T2.north) -- ([xshift=-1.2em,yshift=0em]s_T2.south);
		\node(s_geq1)[draw, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.5em]s_T1.south){ GEQ(+) }; 
		\node(s_geq2)[draw, anchor=north,align=left,fill=white,inner sep=0.3em] at ([xshift=0em,yshift=-1.5em]s_T2.south){ GEQ($-$) }; 
		\node(s_exit)[draw, rounded rectangle, anchor=west,align=left,fill=white,inner sep=0.3em] at ([xshift=1em,yshift=-2.4em]s_geq2.east){出口}; 
		\node(blank)[anchor=west,align=left,fill=white,inner sep=0.3em] at ([xshift=-2em,yshift=0em]s_T1.west){\ };
		
		\draw[->] (s_enter.south) -- (s_T.north);
		\draw[->] (s_T.south) -- (s_select1.north);
		\draw[->] (s_select1.south) -- (s_next1.north);
		\draw[->] (s_select2.south) -- (s_next2.north);
		\draw[->] (s_select1.east) -- (s_select2.west);
		\draw[->] (s_select2.east) -| (s_exit.north);
		\draw[->] (s_next1.south) -- (s_T1.north);
		\draw[->] (s_next2.south) -- (s_T2.north);
		\draw[->] (s_T1.south) -- (s_geq1.north);
		\draw[->] (s_T2.south) -- (s_geq2.north);
		\draw[-] (s_geq1.south) |- ([xshift=-1em,yshift=-1.5em]s_geq1.west);
		\draw[-] (s_geq2.south) |- ([xshift=-1em,yshift=-1.5em]s_geq1.west);
		\draw[->] ([xshift=-1em,yshift=-1.5em]s_geq1.west) |- ([xshift=0em,yshift=-0.5em]s_T.south);
		
		\node(s_R1)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=1em,yshift=-0.6em]s_T.south){\textcolor{blue}{R1}}; 
		\node(s_R2)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=1em,yshift=-0.6em]s_T1.south){\textcolor{blue}{R2}}; 
		\node(s_R3)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=1em,yshift=-0.6em]s_T2.south){\textcolor{blue}{R3}}; 
		\node(s_y1)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=1em,yshift=-0.3em]s_select1.south){y};
		\node(s_n1)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=3em,yshift=0.1em]s_select1.north){n};
		\node(s_y2)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=1em,yshift=-0.3em]s_select2.south){y};
		\node(s_n2)[anchor=north,align=left,fill=white,inner sep=0em] at 
		([xshift=3em,yshift=0.1em]s_select2.north){n};
		
		\node(note1)[draw, rectangle callout,callout relative pointer={(-0.3,-0.2)},rounded corners,align=center,inner sep=0.3em] at ([xshift=3em,yshift=-2em]s_enter.east){ 子程序\ E };
		
		\begin{pgfonlayer}{background}
			\node [draw, draw=black, fill=white,fit=(s_enter)(s_T)(s_select1)(s_select2)(s_next1)(s_next2)(s_T1)(s_T2)(s_geq1)(s_geq2)(s_exit)(blank),inner sep=0.5em] {};
		\end{pgfonlayer}
		
		\node(note)[draw, anchor=east,align=left,fill=yellow!20,inner sep=0.3em] at ([xshift=-9.5em,yshift=0em]s_exit.west){\textcolor{blue}{Ri}\ 返回地址}; 
		
	\end{tikzpicture}
\end{document}
